<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>表单</title>
    <link href="__PUBLIC__/layui/css/layui.css" rel="stylesheet" />
    <style type="text/css">
        .layui-form-pane .layui-form-label{width: 160px;}
        .layui-form-pane .layui-input-block{margin-left: 160px;}
    </style>
</head>
<body class="body">
<form class="layui-form layui-form-pane" action="">
    <if condition="$member_info['m_type'] eq 0">
    <fieldset class="layui-elem-field" style="margin: 10px;">
        <legend>系统基本设置</legend>
        <div style="padding: 15px;">
            <div class="layui-form-item">
                <label class="layui-form-label">底部版权</label>
                <div class="layui-input-block">
                    <input type="text" name="CopyRight" value="{:C('CopyRight')}" lay-verify="requ" autocomplete="off" class="layui-input" >
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">抢购账号创建数量</label>
                <div class="layui-input-inline">
                    <input type="text" name="MaxPanicBuyingAccount"  value="{:C('MaxPanicBuyingAccount')}"  autocomplete="off" placeholder="" class="layui-input">
                </div>
                <img src="__PUBLIC__/Images/help.gif" class="tips_img" title="超级管理员不受限制">
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">团队成员创建数量</label>
                <div class="layui-input-inline">
                    <input type="text" name="MaxTeamUser"  value="{:C('MaxTeamUser')}"  autocomplete="off" placeholder="" class="layui-input">
                </div>
                <img src="__PUBLIC__/Images/help.gif" class="tips_img" title="超级管理员不受限制">
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">团队账号重置密码</label>
                <div class="layui-input-inline">
                    <input type="text" name="TeamDefaultPwd" value="{:C('TeamDefaultPwd')}" lay-verify="pass" autocomplete="off" placeholder="" class="layui-input">
                </div>
                <img src="__PUBLIC__/Images/help.gif" class="tips_img" title="超级管理员不受限制">
            </div>
        </div>
    </fieldset>
    </if>
    <fieldset class="layui-elem-field" style="margin: 10px;">
        <legend>团队基本设置</legend>
        <div style="padding: 15px;">
            <div class="layui-form-item">
                <label class="layui-form-label">团队名称</label>
                <div class="layui-input-inline">
                    <input type="text" name="tname" lay-verify="teamname" value="{$memberinfo['t_name']}" autocomplete="off" class="layui-input" >
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">地址特征</label>
                <div class="layui-input-inline">
                    <input type="text" name="addressfeatures" value="{$memberinfo['addressfeatures']}" autocomplete="off" class="layui-input" >
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">成员重置默认密码</label>
                <div class="layui-input-inline">
                    <input type="text" name="defaultpwd" value="{$memberinfo['defaultpwd']}" lay-verify="pass" autocomplete="off" placeholder="" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">抢购账号密码</label>
                <div class="layui-input-inline">
                    <input type="text" name="defaultAccountPwd" value="{$memberinfo['defaultAccountPwd']}" lay-verify="pass" autocomplete="off" placeholder="" class="layui-input">
                </div>
            </div>
         <!--   <div class="layui-form-item">
                <label class="layui-form-label">批量地址中心点范围</label>
                <div class="layui-input-inline">
                    <input type="text" name="defaultKm" value="{$memberinfo['adresskm']}" autocomplete="off" placeholder="单位（KM）" class="layui-input">
                </div>
            </div>-->

            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">批量团队账号年龄</label>
                    <div class="layui-input-inline">
                        <input class="layui-input" placeholder="最小年龄"  value="{$memberinfo['adressmindate']}"  lay-verify="number"   name="agestarttime"  >
                    </div>
                    <div class="layui-form-mid">-</div>
                    <div class="layui-input-inline">
                        <input class="layui-input" placeholder="最大年龄"  value="{$memberinfo['adressmaxdate']}"  lay-verify="number"  name="ageendtime">
                    </div>
                </div>
                <img src="__PUBLIC__/Images/help.gif" class="tips_img" id="nianlin" title="抢购用户生成年龄生日在x-x年之间">
            </div>
        </div>
    </fieldset>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit="" lay-filter="tosetup">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>
<script type="text/javascript" src="__PUBLIC__/layui/layui.js"></script>
<script type="text/javascript">
    layui.use(['form'], function(){
        var form = layui.form()
            ,layer = layui.layer
            ,$ =layui.jquery
            ,layedit = layui.layedit
            ,laydate = layui.laydate;

        form.verify({
            teamname: function(value){
                if(!new RegExp("^$|^[a-zA-Z0-9_\u4e00-\u9fa5\\s·]+$").test(value)){
                    return '团队名称不能有特殊字符';
                }else if(/(^\_)|(\__)|(\_+$)/.test(value)){
                    return '用户名首尾不能出现下划线\'_\'';
                }else if(/^\d+\d+\d$/.test(value)){
                    return '用户名不能全为数字';
                }
                return;
            },
            username: function(value){
                if(!new RegExp("^$|^[^(and|or|exec|insert|select|union|update|&&|count|*|%)]*$").test(value)){
                    return '用户名不能有特殊字符';
                }else if(/(^\_)|(\__)|(\_+$)/.test(value)){
                    return '用户名首尾不能出现下划线\'_\'';
                }
                return;
            },title: function(value){
                if(value.trim().length < 5){
                    return '标题至少得5个字符啊';
                }
            }
            ,pass: [/^$|^(?:(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])).{6,12}$/, '密码大小写字母和数字组合']
            ,content: function(value){
                layedit.sync(editIndex);
            }

        });
        //监听提交
        form.on('submit(tosetup)', function(data){
            var userInfo = data.field;
            var url = "__SELF__";
            $.post(url,userInfo,function(data){
                if(data.code == '4001'){
                    layer.msg(data.msg,{icon: 5});
                    return;
                }else if(data.code == '101'){
                    layer.msg(data.msg, {
                        icon: 6,
                        time: 2000
                    }, function(){
                        location.reload();
                    });
                }
            });
            return false;
        });


    });
</script>
</body>
</html>